package ten;

public class 十十线程信息 {
    public static void main(String[] args) throws Exception {
        Runnable r = new TestThread();
        Thread t1 = new Thread(r, "ct1");
        Thread t2 = new Thread(r, "ct2");
        t1.start();
        t2.start();
        t1.setPriority(1);
        t2.setPriority(10);
        System.out.println(t1.getPriority() + "----" + t2.getPriority());
        System.out.println(t1.getName() + "----" + t2.getName());
        t1.sleep(2);
        //守护线程
        t1.setDaemon(true);
        t2.sleep(3);
        System.out.println(t1.isAlive());
    }
}


class TestThread implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + ": " + i);
        }
    }
}
